package com.example.toolproject.demo.service.serviceimpl;

import com.example.toolproject.demo.domain.UserDataSearch;
import com.example.toolproject.demo.mapper.UserDataSearchMapper;
import com.example.toolproject.demo.service.UserDataSearchService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @ClassName UserDataSearchServiceImpl
 * @Description TODO
 * @Author lvyongwei
 * @Date 2020-06-29 15:00
 **/
@Service
public class UserDataSearchServiceImpl implements UserDataSearchService {

    @Autowired
    private UserDataSearchMapper userDataSearchMapper;

    /**
     * 用户引用数据资源操作
     * @param list  资源数据id集合
     * @param userId 用户id
     * @return
     */
    @Override
    public boolean referenceData(List<String> list, int userId) {
        return userDataSearchMapper.referenceData(list,userId);
    }

    /**
     * 用戶取消引用數據
     * @param list 资源数据id集合
     * @param userId 用户id
     * @return
     */
    @Override
    public boolean cancelReference(List<String> list, int userId) {
        return userDataSearchMapper.cancelReference(list,userId);
    }

    /**
     * 判断是否存在即是否已引用
     * @param userId
     * @param dataSearchId
     * @return
     */
    @Override
    public UserDataSearch ifExist(int userId, long dataSearchId) {
        return userDataSearchMapper.ifExist(userId,dataSearchId);
    }
}
